package com.feicheng.controller.main.admin.store;


import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.entity.WxServer;
import com.feicheng.service.IFStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cailongyang
 * @since 2021-12-02
 */
@RestController
@RequestMapping("/main/admin/store/wx-server")
public class WxServerController {
    @Autowired
    IFStoreService ifStoreService;
    @PostMapping("/info")
    public ResultInfo newWxServer(String wxServer, Integer storeId) {
        return ifStoreService.newWxServer(JSONObject.parseObject(wxServer, WxServer.class),storeId);
    }
    @DeleteMapping("/info")
    public ResultInfo deleteWxServer(Integer wId) {
        return ifStoreService.deleteWxServer(wId);
    }
    @PutMapping("/info")
    public ResultInfo updateWxServer(String wxServer) {
        return ifStoreService.updateWxServer(JSONObject.parseObject(wxServer,WxServer.class));
    }
    @GetMapping("/info")
    public ResultInfo getWxServerById(Integer wId) {
        return ifStoreService.getWxServer(wId);
    }
}
